#ifndef CALCULATETHREEPOINTMATRIXTRANSFORM_H
#define CALCULATETHREEPOINTMATRIXTRANSFORM_H
#include <vector>
using namespace std;
#include <Eigen/Dense>


class CalculateThreePointMatrixTransform
{
public:
    CalculateThreePointMatrixTransform();

public:
    //不忽略比例
    int calculateTransform(vector<float> point1onA,vector<float> point2onA,vector<float> point3onA,
                           vector<float> point1onB,vector<float> point2onB,vector<float> point3onB
                 ,Eigen::Matrix3f& rotationOut, Eigen::Vector3f& translationOut,float &ratioOut);

    int calculateTransformNew(vector<double> point1onA,vector<double> point2onA,vector<double> point3onA,
                           vector<double> point1onB,vector<double> point2onB,vector<double> point3onB
                 ,Eigen::Matrix3f& rotationOut, Eigen::Vector3f& translationOut,float &ratioOut);
    int calculateTransformNew2(vector<double> point1onA, vector<double> point2onA, vector<double> point3onA,
                           vector<double> point1onB, vector<double> point2onB, vector<double> point3onB
                 , Eigen::Matrix3f& rotationOut, Eigen::Vector3f& translationOut, float &ratioOut);


    int calculateTransform2(vector<vector<float> > point1onA,
                            vector<vector<float> > point1onB, Eigen::Matrix3f &rotationOut,
                                                 Eigen::Vector3f &translationOut, float &ratioOut);

private:
    double  ThreePointsTransMatrix(double *Point1InA, double *Point2InA, double *Point3InA,
                                            double *Point1InB, double *Point2InB, double *Point3InB,
                                            double *dOutRotateMatrixAToB, double *dOutTranslationMatrixAToB,
                                            double *Deviation);
    double  Rref(double *RotateB, double  *RotateA, double *RotateBToA);
    double  CrossMultiply(double *matrixa, double  *matrixb, double *VectorResult);
    int  caliratio(vector<float> point1onA,vector<float> point2onA,vector<float> point3onA,
                   vector<float> point1onB,vector<float> point2onB,vector<float> point3onB  ,float &ratioOut);
    int caliRotation(vector<float> point1onA, vector<float> point2onA, vector<float> point3onA,
                     vector<float> point1onB, vector<float> point2onB, vector<float> point3onB, float ratioIn, Eigen::Matrix3f &rotationOut);
    int caliTranslation(vector<float> point1onA,vector<float> point1onB,
                        Eigen::Matrix3f rotation, Eigen::Vector3f& translationOut);
    float distanceOfPoint(vector<float> point1,vector<float> point2);
};

#endif // CALCULATETHREEPOINTMATRIXTRANSFORM_H
